<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Stg to C-- code generation</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- (c) The University of Glasgow 2004-2006</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.StgToCmm</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.StgToCmm.html#codeGen"><span class="hs-identifier">codeGen</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Prof.html"><span class="hs-identifier">GHC.StgToCmm.Prof</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Prof.html#initCostCentres"><span class="hs-identifier">initCostCentres</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Prof.html#ldvEnter"><span class="hs-identifier">ldvEnter</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html"><span class="hs-identifier">GHC.StgToCmm.Monad</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Env.html"><span class="hs-identifier">GHC.StgToCmm.Env</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Bind.html"><span class="hs-identifier">GHC.StgToCmm.Bind</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.DataCon.html"><span class="hs-identifier">GHC.StgToCmm.DataCon</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html"><span class="hs-identifier">GHC.StgToCmm.Layout</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Utils.html"><span class="hs-identifier">GHC.StgToCmm.Utils</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html"><span class="hs-identifier">GHC.StgToCmm.Closure</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Hpc.html"><span class="hs-identifier">GHC.StgToCmm.Hpc</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Ticky.html"><span class="hs-identifier">GHC.StgToCmm.Ticky</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html"><span class="hs-identifier">GHC.StgToCmm.Types</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Types.html#ModuleLFInfos"><span class="hs-identifier">ModuleLFInfos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Utils.html"><span class="hs-identifier">GHC.Cmm.Utils</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html"><span class="hs-identifier">GHC.Cmm.CLabel</span></a></span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html"><span class="hs-identifier">GHC.Types.CostCentre</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html"><span class="hs-identifier">GHC.Types.Id.Info</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.RepType.html"><span class="hs-identifier">GHC.Types.RepType</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html"><span class="hs-identifier">GHC.Data.Stream</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#isEmptyDVarSet"><span class="hs-identifier">isEmptyDVarSet</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.SysTools.FileCleanup.html"><span class="hs-identifier">GHC.SysTools.FileCleanup</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.OrdList.html"><span class="hs-identifier">GHC.Data.OrdList</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html"><span class="hs-identifier">GHC.Cmm.Graph</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier">when</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Functor.html#void"><span class="hs-identifier">void</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.html#"><span class="hs-identifier">Data.ByteString</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">BS</span></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="annot"><a href="GHC.StgToCmm.html#codeGen"><span class="hs-identifier hs-type">codeGen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-66"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-67"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-68"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>                </span><span class="hs-comment">-- (Local/global) cost-centres needing declaring/registering.</span><span>
</span><span id="line-69"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgTopBinding"><span class="hs-identifier hs-type">CgStgTopBinding</span></a></span><span class="hs-special">]</span><span>           </span><span class="hs-comment">-- Bindings to convert</span><span>
</span><span id="line-70"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HpcInfo"><span class="hs-identifier hs-type">HpcInfo</span></a></span><span>
</span><span id="line-71"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmGroup"><span class="hs-identifier hs-type">CmmGroup</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#ModuleLFInfos"><span class="hs-identifier hs-type">ModuleLFInfos</span></a></span><span>
</span><span id="line-72"></span><span>                                       </span><span class="hs-comment">-- Output as a stream, so codegen can</span><span>
</span><span id="line-73"></span><span>                                       </span><span class="hs-comment">-- be interleaved with output</span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span id="codeGen"><span class="annot"><span class="annottext">codeGen :: DynFlags
-&gt; Module
-&gt; [TyCon]
-&gt; CollectedCCs
-&gt; [CgStgTopBinding]
-&gt; HpcInfo
-&gt; Stream IO CmmGroup ModuleLFInfos
</span><a href="GHC.StgToCmm.html#codeGen"><span class="hs-identifier hs-var hs-var">codeGen</span></a></span></span><span> </span><span id="local-6989586621681062650"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062650"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681062649"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681062649"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621681062648"><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681062648"><span class="hs-identifier hs-var">data_tycons</span></a></span></span><span>
</span><span id="line-76"></span><span>        </span><span id="local-6989586621681062647"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621681062647"><span class="hs-identifier hs-var">cost_centre_info</span></a></span></span><span> </span><span id="local-6989586621681062646"><span class="annot"><span class="annottext">[CgStgTopBinding]
</span><a href="#local-6989586621681062646"><span class="hs-identifier hs-var">stg_binds</span></a></span></span><span> </span><span id="local-6989586621681062645"><span class="annot"><span class="annottext">HpcInfo
</span><a href="#local-6989586621681062645"><span class="hs-identifier hs-var">hpc_info</span></a></span></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span>     </span><span class="hs-comment">-- cg: run the code generator, and yield the resulting CmmGroup</span><span>
</span><span id="line-78"></span><span>              </span><span class="hs-comment">-- Using an IORef to store the state is a bit crude, but otherwise</span><span>
</span><span id="line-79"></span><span>              </span><span class="hs-comment">-- we would need to add a state monad layer.</span><span>
</span><span id="line-80"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681062644"><span class="annot"><span class="annottext">IORef CgState
</span><a href="#local-6989586621681062644"><span class="hs-identifier hs-var">cgref</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (IORef CgState) -&gt; Stream IO CmmGroup (IORef CgState)
forall a b. IO a -&gt; Stream IO b a
</span><a href="GHC.Data.Stream.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IORef CgState) -&gt; Stream IO CmmGroup (IORef CgState))
-&gt; IO (IORef CgState) -&gt; Stream IO CmmGroup (IORef CgState)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CgState -&gt; IO (IORef CgState)
forall a. a -&gt; IO (IORef a)
</span><a href="../../base/src/GHC.IORef.html#newIORef"><span class="hs-identifier hs-var">newIORef</span></a></span><span> </span><span class="annot"><span class="annottext">(CgState -&gt; IO (IORef CgState)) -&gt; IO CgState -&gt; IO (IORef CgState)
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">IO CgState
</span><a href="GHC.StgToCmm.Monad.html#initC"><span class="hs-identifier hs-var">initC</span></a></span><span>
</span><span id="line-81"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681062639"><span class="hs-identifier hs-type">cg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmGroup"><span class="hs-identifier hs-type">CmmGroup</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-82"></span><span>              </span><span id="local-6989586621681062639"><span class="annot"><span class="annottext">cg :: FCode () -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062639"><span class="hs-identifier hs-var hs-var">cg</span></a></span></span><span> </span><span id="local-6989586621681062638"><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681062638"><span class="hs-identifier hs-var">fcode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-83"></span><span>                </span><span id="local-6989586621681062637"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681062637"><span class="hs-identifier hs-var">cmm</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO CmmGroup -&gt; Stream IO CmmGroup CmmGroup
forall a b. IO a -&gt; Stream IO b a
</span><a href="GHC.Data.Stream.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO CmmGroup -&gt; Stream IO CmmGroup CmmGroup)
-&gt; (IO CmmGroup -&gt; IO CmmGroup)
-&gt; IO CmmGroup
-&gt; Stream IO CmmGroup CmmGroup
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; (CmmGroup -&gt; ()) -&gt; IO CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a.
MonadIO m =&gt;
DynFlags -&gt; SDoc -&gt; (a -&gt; ()) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Error.html#withTimingSilent"><span class="hs-identifier hs-var">withTimingSilent</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062650"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;STG -&gt; Cmm&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmGroup -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO CmmGroup -&gt; Stream IO CmmGroup CmmGroup)
-&gt; IO CmmGroup -&gt; Stream IO CmmGroup CmmGroup
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-84"></span><span>                         </span><span id="local-6989586621681062633"><span class="annot"><span class="annottext">CgState
</span><a href="#local-6989586621681062633"><span class="hs-identifier hs-var">st</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IORef CgState -&gt; IO CgState
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef CgState
</span><a href="#local-6989586621681062644"><span class="hs-identifier hs-var">cgref</span></a></span><span>
</span><span id="line-85"></span><span>                         </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681062631"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681062631"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681062630"><span class="annot"><span class="annottext">CgState
</span><a href="#local-6989586621681062630"><span class="hs-identifier hs-var">st'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Module -&gt; CgState -&gt; FCode CmmGroup -&gt; (CmmGroup, CgState)
forall a. DynFlags -&gt; Module -&gt; CgState -&gt; FCode a -&gt; (a, CgState)
</span><a href="GHC.StgToCmm.Monad.html#runC"><span class="hs-identifier hs-var">runC</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062650"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681062649"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">CgState
</span><a href="#local-6989586621681062633"><span class="hs-identifier hs-var">st</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FCode () -&gt; FCode CmmGroup
</span><a href="GHC.StgToCmm.Monad.html#getCmm"><span class="hs-identifier hs-var">getCmm</span></a></span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681062638"><span class="hs-identifier hs-var">fcode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>                         </span><span class="hs-comment">-- NB. stub-out cgs_tops and cgs_stmts.  This fixes</span><span>
</span><span id="line-88"></span><span>                         </span><span class="hs-comment">-- a big space leak.  DO NOT REMOVE!</span><span>
</span><span id="line-89"></span><span>                         </span><span class="annot"><span class="annottext">IORef CgState -&gt; CgState -&gt; IO ()
forall a. IORef a -&gt; a -&gt; IO ()
</span><a href="../../base/src/GHC.IORef.html#writeIORef"><span class="hs-identifier hs-var">writeIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef CgState
</span><a href="#local-6989586621681062644"><span class="hs-identifier hs-var">cgref</span></a></span><span> </span><span class="annot"><span class="annottext">(CgState -&gt; IO ()) -&gt; CgState -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">CgState
</span><a href="#local-6989586621681062630"><span class="hs-identifier hs-var">st'</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cgs_tops :: OrdList CmmDecl
</span><a href="GHC.StgToCmm.Monad.html#cgs_tops"><span class="hs-identifier hs-var">cgs_tops</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OrdList CmmDecl
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-90"></span><span>                                                  </span><span class="annot"><span class="annottext">cgs_stmts :: CmmAGraph
</span><a href="GHC.StgToCmm.Monad.html#cgs_stmts"><span class="hs-identifier hs-var">cgs_stmts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkNop"><span class="hs-identifier hs-var">mkNop</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-91"></span><span>                         </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681062631"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-92"></span><span>                </span><span class="annot"><span class="annottext">CmmGroup -&gt; Stream IO CmmGroup ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; Stream m a ()
</span><a href="GHC.Data.Stream.html#yield"><span class="hs-identifier hs-var">yield</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681062637"><span class="hs-identifier hs-var">cmm</span></a></span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span>               </span><span class="hs-comment">-- Note [codegen-split-init] the cmm_init block must come</span><span>
</span><span id="line-95"></span><span>               </span><span class="hs-comment">-- FIRST.  This is because when -split-objs is on we need to</span><span>
</span><span id="line-96"></span><span>               </span><span class="hs-comment">-- combine this block with its initialisation routines; see</span><span>
</span><span id="line-97"></span><span>               </span><span class="hs-comment">-- Note [pipeline-split-init].</span><span>
</span><span id="line-98"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode () -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062639"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CollectedCCs -&gt; Module -&gt; HpcInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#mkModuleInit"><span class="hs-identifier hs-var">mkModuleInit</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621681062647"><span class="hs-identifier hs-var">cost_centre_info</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681062649"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">HpcInfo
</span><a href="#local-6989586621681062645"><span class="hs-identifier hs-var">hpc_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(CgStgTopBinding -&gt; Stream IO CmmGroup ())
-&gt; [CgStgTopBinding] -&gt; Stream IO CmmGroup ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FCode () -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062639"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; Stream IO CmmGroup ())
-&gt; (CgStgTopBinding -&gt; FCode ())
-&gt; CgStgTopBinding
-&gt; Stream IO CmmGroup ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; CgStgTopBinding -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgTopBinding"><span class="hs-identifier hs-var">cgTopBinding</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062650"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[CgStgTopBinding]
</span><a href="#local-6989586621681062646"><span class="hs-identifier hs-var">stg_binds</span></a></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>                </span><span class="hs-comment">-- Put datatype_stuff after code_stuff, because the</span><span>
</span><span id="line-103"></span><span>                </span><span class="hs-comment">-- datatype closure table (for enumeration types) to</span><span>
</span><span id="line-104"></span><span>                </span><span class="hs-comment">-- (say) PrelBase_True_closure, which is defined in</span><span>
</span><span id="line-105"></span><span>                </span><span class="hs-comment">-- code_stuff</span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681062611"><span class="annot"><span class="annottext">do_tycon :: TyCon -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062611"><span class="hs-identifier hs-var hs-var">do_tycon</span></a></span></span><span> </span><span id="local-6989586621681062610"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062610"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-107"></span><span>                </span><span class="hs-comment">-- Generate a table of static closures for an</span><span>
</span><span id="line-108"></span><span>                </span><span class="hs-comment">-- enumeration type Note that the closure pointers are</span><span>
</span><span id="line-109"></span><span>                </span><span class="hs-comment">-- tagged.</span><span>
</span><span id="line-110"></span><span>                 </span><span class="annot"><span class="annottext">Bool -&gt; Stream IO CmmGroup () -&gt; Stream IO CmmGroup ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isEnumerationTyCon"><span class="hs-identifier hs-var">isEnumerationTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062610"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Stream IO CmmGroup () -&gt; Stream IO CmmGroup ())
-&gt; Stream IO CmmGroup () -&gt; Stream IO CmmGroup ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">FCode () -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062639"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgEnumerationTyCon"><span class="hs-identifier hs-var">cgEnumerationTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062610"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>                 </span><span class="annot"><span class="annottext">(DataCon -&gt; Stream IO CmmGroup ())
-&gt; [DataCon] -&gt; Stream IO CmmGroup ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FCode () -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062639"><span class="hs-identifier hs-var">cg</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; Stream IO CmmGroup ())
-&gt; (DataCon -&gt; FCode ()) -&gt; DataCon -&gt; Stream IO CmmGroup ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgDataCon"><span class="hs-identifier hs-var">cgDataCon</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062610"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Stream IO CmmGroup ())
-&gt; [TyCon] -&gt; Stream IO CmmGroup ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Stream IO CmmGroup ()
</span><a href="#local-6989586621681062611"><span class="hs-identifier hs-var">do_tycon</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681062648"><span class="hs-identifier hs-var">data_tycons</span></a></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681062605"><span class="annot"><span class="annottext">CgBindings
</span><a href="#local-6989586621681062605"><span class="hs-identifier hs-var">cg_id_infos</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CgState -&gt; CgBindings
</span><a href="GHC.StgToCmm.Monad.html#cgs_binds"><span class="hs-identifier hs-var hs-var">cgs_binds</span></a></span><span> </span><span class="annot"><span class="annottext">(CgState -&gt; CgBindings)
-&gt; Stream IO CmmGroup CgState -&gt; Stream IO CmmGroup CgBindings
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IO CgState -&gt; Stream IO CmmGroup CgState
forall a b. IO a -&gt; Stream IO b a
</span><a href="GHC.Data.Stream.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IORef CgState -&gt; IO CgState
forall a. IORef a -&gt; IO a
</span><a href="../../base/src/GHC.IORef.html#readIORef"><span class="hs-identifier hs-var">readIORef</span></a></span><span> </span><span class="annot"><span class="annottext">IORef CgState
</span><a href="#local-6989586621681062644"><span class="hs-identifier hs-var">cgref</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span>          </span><span class="hs-comment">-- See Note [Conveying CAF-info and LFInfo between modules] in</span><span>
</span><span id="line-118"></span><span>          </span><span class="hs-comment">-- GHC.StgToCmm.Types</span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681062602"><span class="annot"><span class="annottext">extractInfo :: CgIdInfo -&gt; (Name, LambdaFormInfo)
</span><a href="#local-6989586621681062602"><span class="hs-identifier hs-var hs-var">extractInfo</span></a></span></span><span> </span><span id="local-6989586621681062601"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681062601"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681062600"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681062599"><span class="hs-identifier hs-var">lf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-120"></span><span>                </span><span class="hs-keyword">where</span><span>
</span><span id="line-121"></span><span>                  </span><span class="hs-glyph">!</span><span id="local-6989586621681062600"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681062600"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgIdInfo -&gt; Id
</span><a href="GHC.StgToCmm.Monad.html#cg_id"><span class="hs-identifier hs-var hs-var">cg_id</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681062601"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>                  </span><span class="hs-glyph">!</span><span id="local-6989586621681062599"><span class="annot"><span class="annottext">lf :: LambdaFormInfo
</span><a href="#local-6989586621681062599"><span class="hs-identifier hs-var hs-var">lf</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CgIdInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Monad.html#cg_lf"><span class="hs-identifier hs-var hs-var">cg_lf</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681062601"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span>              </span><span class="hs-glyph">!</span><span id="local-6989586621681062595"><span class="annot"><span class="annottext">generatedInfo :: ModuleLFInfos
</span><a href="#local-6989586621681062595"><span class="hs-identifier hs-var hs-var">generatedInfo</span></a></span></span><span>
</span><span id="line-125"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_OmitInterfacePragmas"><span class="hs-identifier hs-var">Opt_OmitInterfacePragmas</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062650"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-126"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleLFInfos
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-127"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-128"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, LambdaFormInfo)] -&gt; ModuleLFInfos
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CgIdInfo -&gt; (Name, LambdaFormInfo))
-&gt; [CgIdInfo] -&gt; [(Name, LambdaFormInfo)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">Prelude.map</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo -&gt; (Name, LambdaFormInfo)
</span><a href="#local-6989586621681062602"><span class="hs-identifier hs-var">extractInfo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgBindings -&gt; [CgIdInfo]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#eltsUFM"><span class="hs-identifier hs-var">eltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">CgBindings
</span><a href="#local-6989586621681062605"><span class="hs-identifier hs-var">cg_id_infos</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ModuleLFInfos -&gt; Stream IO CmmGroup ModuleLFInfos
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleLFInfos
</span><a href="#local-6989586621681062595"><span class="hs-identifier hs-var">generatedInfo</span></a></span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-134"></span><span class="hs-comment">--      Top-level bindings</span><span>
</span><span id="line-135"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span class="hs-comment">{- 'cgTopBinding' is only used for top-level bindings, since they need
to be allocated statically (not in the heap) and need to be labelled.
No unboxed bindings can happen at top level.

In the code below, the static bindings are accumulated in the
@MkCgState@, and transferred into the ``statics'' slot by @forkStatics@.
This is so that we can write the top level processing in a compositional
style, with the increasing static environment being plumbed as a state
variable. -}</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="annot"><a href="GHC.StgToCmm.html#cgTopBinding"><span class="hs-identifier hs-type">cgTopBinding</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgTopBinding"><span class="hs-identifier hs-type">CgStgTopBinding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span id="cgTopBinding"><span class="annot"><span class="annottext">cgTopBinding :: DynFlags -&gt; CgStgTopBinding -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgTopBinding"><span class="hs-identifier hs-var hs-var">cgTopBinding</span></a></span></span><span> </span><span id="local-6989586621681062589"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062589"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopLifted"><span class="hs-identifier hs-type">StgTopLifted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-type">StgNonRec</span></a></span><span> </span><span id="local-6989586621681062586"><span class="annot"><span class="annottext">BinderP 'CodeGen
</span><a href="#local-6989586621681062586"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681062585"><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681062585"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681062584"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681062584"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681062583"><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681062583"><span class="hs-identifier hs-var">fcode</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; RecFlag -&gt; Id -&gt; GenStgRhs 'CodeGen -&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.html#cgTopRhs"><span class="hs-identifier hs-var">cgTopRhs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062589"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681062586"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681062585"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-150"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681062583"><span class="hs-identifier hs-var">fcode</span></a></span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CgIdInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Env.html#addBindC"><span class="hs-identifier hs-var">addBindC</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681062584"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-152"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="annot"><a href="GHC.StgToCmm.html#cgTopBinding"><span class="hs-identifier hs-var">cgTopBinding</span></a></span><span> </span><span id="local-6989586621681062579"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062579"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopLifted"><span class="hs-identifier hs-type">StgTopLifted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-type">StgRec</span></a></span><span> </span><span id="local-6989586621681062577"><span class="annot"><span class="annottext">[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681062577"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681062576"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681062576"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681062575"><span class="annot"><span class="annottext">[GenStgRhs 'CodeGen]
</span><a href="#local-6989586621681062575"><span class="hs-identifier hs-var">rhss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)] -&gt; ([Id], [GenStgRhs 'CodeGen])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)]
[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681062577"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-156"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681062573"><span class="annot"><span class="annottext">pairs' :: [(Id, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681062573"><span class="hs-identifier hs-var hs-var">pairs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [GenStgRhs 'CodeGen] -&gt; [(Id, GenStgRhs 'CodeGen)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681062576"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenStgRhs 'CodeGen]
</span><a href="#local-6989586621681062575"><span class="hs-identifier hs-var">rhss</span></a></span><span>
</span><span id="line-157"></span><span>              </span><span id="local-6989586621681062572"><span class="annot"><span class="annottext">r :: [(CgIdInfo, FCode ())]
</span><a href="#local-6989586621681062572"><span class="hs-identifier hs-var hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; GenStgRhs 'CodeGen -&gt; (CgIdInfo, FCode ()))
-&gt; [(Id, GenStgRhs 'CodeGen)] -&gt; [(CgIdInfo, FCode ())]
forall a b c. (a -&gt; b -&gt; c) -&gt; [(a, b)] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier hs-var">unzipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags
-&gt; RecFlag -&gt; Id -&gt; GenStgRhs 'CodeGen -&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.html#cgTopRhs"><span class="hs-identifier hs-var">cgTopRhs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062579"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#Recursive"><span class="hs-identifier hs-var">Recursive</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681062573"><span class="hs-identifier hs-var">pairs'</span></a></span><span>
</span><span id="line-158"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621681062569"><span class="annot"><span class="annottext">[CgIdInfo]
</span><a href="#local-6989586621681062569"><span class="hs-identifier hs-var">infos</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681062568"><span class="annot"><span class="annottext">[FCode ()]
</span><a href="#local-6989586621681062568"><span class="hs-identifier hs-var">fcodes</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(CgIdInfo, FCode ())] -&gt; ([CgIdInfo], [FCode ()])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(CgIdInfo, FCode ())]
</span><a href="#local-6989586621681062572"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-159"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[CgIdInfo] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Env.html#addBindsC"><span class="hs-identifier hs-var">addBindsC</span></a></span><span> </span><span class="annot"><span class="annottext">[CgIdInfo]
</span><a href="#local-6989586621681062569"><span class="hs-identifier hs-var">infos</span></a></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[FCode ()] -&gt; FCode ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Foldable t, Monad m) =&gt;
t (m a) -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#sequence_"><span class="hs-identifier hs-var">sequence_</span></a></span><span> </span><span class="annot"><span class="annottext">[FCode ()]
</span><a href="#local-6989586621681062568"><span class="hs-identifier hs-var">fcodes</span></a></span><span>
</span><span id="line-161"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="annot"><a href="GHC.StgToCmm.html#cgTopBinding"><span class="hs-identifier hs-var">cgTopBinding</span></a></span><span> </span><span id="local-6989586621681062565"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopStringLit"><span class="hs-identifier hs-type">StgTopStringLit</span></a></span><span> </span><span id="local-6989586621681062563"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062563"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681062562"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621681062562"><span class="hs-identifier hs-var">str</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-164"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681062561"><span class="annot"><span class="annottext">label :: CLabel
</span><a href="#local-6989586621681062561"><span class="hs-keyword hs-var hs-var">label</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkBytesLabel"><span class="hs-identifier hs-var">mkBytesLabel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062563"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>  </span><span class="hs-comment">-- emit either a CmmString literal or dump the string in a file and emit a</span><span>
</span><span id="line-166"></span><span>  </span><span class="hs-comment">-- CmmFileEmbed literal.</span><span>
</span><span id="line-167"></span><span>  </span><span class="hs-comment">-- See Note [Embedding large binary blobs] in GHC.CmmToAsm.Ppr</span><span>
</span><span id="line-168"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681062557"><span class="annot"><span class="annottext">isNCG :: Bool
</span><a href="#local-6989586621681062557"><span class="hs-identifier hs-var hs-var">isNCG</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; HscTarget
</span><a href="GHC.Driver.Session.html#hscTarget"><span class="hs-identifier hs-var hs-var">hscTarget</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscTarget -&gt; HscTarget -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">HscTarget
</span><a href="GHC.Driver.Session.html#HscAsm"><span class="hs-identifier hs-var">HscAsm</span></a></span><span>
</span><span id="line-169"></span><span>      </span><span id="local-6989586621681062548"><span class="annot"><span class="annottext">isSmall :: Bool
</span><a href="#local-6989586621681062548"><span class="hs-identifier hs-var hs-var">isSmall</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">BS.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621681062562"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Word
</span><a href="GHC.Driver.Session.html#binBlobThreshold"><span class="hs-identifier hs-var hs-var">binBlobThreshold</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-170"></span><span>      </span><span id="local-6989586621681062541"><span class="annot"><span class="annottext">asString :: Bool
</span><a href="#local-6989586621681062541"><span class="hs-identifier hs-var hs-var">asString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Word
</span><a href="GHC.Driver.Session.html#binBlobThreshold"><span class="hs-identifier hs-var hs-var">binBlobThreshold</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681062548"><span class="hs-identifier hs-var">isSmall</span></a></span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681062536"><span class="annot"><span class="annottext">CmmLit
</span><a href="#local-6989586621681062536"><span class="hs-identifier hs-var">lit</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681062535"><span class="annot"><span class="annottext">GenCmmDecl (GenCmmStatics raw) info stmt
</span><a href="#local-6989586621681062535"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681062557"><span class="hs-identifier hs-var">isNCG</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681062541"><span class="hs-identifier hs-var">asString</span></a></span><span>
</span><span id="line-173"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CLabel
-&gt; ByteString -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt)
forall (raw :: Bool) info stmt.
CLabel
-&gt; ByteString -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt)
</span><a href="GHC.Cmm.Utils.html#mkByteStringCLit"><span class="hs-identifier hs-var">mkByteStringCLit</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681062561"><span class="hs-keyword hs-var">label</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621681062562"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-174"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CLabel
-&gt; String -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt)
forall (raw :: Bool) info stmt.
CLabel
-&gt; String -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt)
</span><a href="GHC.Cmm.Utils.html#mkFileEmbedLit"><span class="hs-identifier hs-var">mkFileEmbedLit</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681062561"><span class="hs-keyword hs-var">label</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt))
-&gt; String -&gt; (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IO String -&gt; String
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO String -&gt; String) -&gt; IO String -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-175"></span><span>               </span><span id="local-6989586621681062530"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681062530"><span class="hs-identifier hs-var">bFile</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TempFileLifetime -&gt; String -&gt; IO String
</span><a href="GHC.SysTools.FileCleanup.html#newTempName"><span class="hs-identifier hs-var">newTempName</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileLifetime
</span><a href="GHC.SysTools.FileCleanup.html#TFL_CurrentModule"><span class="hs-identifier hs-var">TFL_CurrentModule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.dat&quot;</span></span><span>
</span><span id="line-176"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; ByteString -&gt; IO ()
</span><a href="../../bytestring/src/Data.ByteString.html#writeFile"><span class="hs-identifier hs-var">BS.writeFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681062530"><span class="hs-identifier hs-var">bFile</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621681062562"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-177"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681062530"><span class="hs-identifier hs-var">bFile</span></a></span><span>
</span><span id="line-178"></span><span>  </span><span class="annot"><span class="annottext">CmmDecl -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitDecl"><span class="hs-identifier hs-var">emitDecl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmDecl
forall {raw :: Bool} {info} {stmt}.
GenCmmDecl (GenCmmStatics raw) info stmt
</span><a href="#local-6989586621681062535"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-179"></span><span>  </span><span class="annot"><span class="annottext">CgIdInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Env.html#addBindC"><span class="hs-identifier hs-var">addBindC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Id -&gt; LambdaFormInfo -&gt; CmmLit -&gt; CgIdInfo
</span><a href="GHC.StgToCmm.Env.html#litIdInfo"><span class="hs-identifier hs-var">litIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062565"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062563"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#mkLFStringLit"><span class="hs-identifier hs-var">mkLFStringLit</span></a></span><span> </span><span class="annot"><span class="annottext">CmmLit
</span><a href="#local-6989586621681062536"><span class="hs-identifier hs-var">lit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span class="annot"><a href="GHC.StgToCmm.html#cgTopRhs"><span class="hs-identifier hs-type">cgTopRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgRhs"><span class="hs-identifier hs-type">CgStgRhs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Monad.html#CgIdInfo"><span class="hs-identifier hs-type">CgIdInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-comment">-- The Id is passed along for setting up a binding...</span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span id="cgTopRhs"><span class="annot"><span class="annottext">cgTopRhs :: DynFlags
-&gt; RecFlag -&gt; Id -&gt; GenStgRhs 'CodeGen -&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.html#cgTopRhs"><span class="hs-identifier hs-var hs-var">cgTopRhs</span></a></span></span><span> </span><span id="local-6989586621681062522"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062522"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681062521"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681062521"><span class="hs-identifier hs-var">_rec</span></a></span></span><span> </span><span id="local-6989586621681062520"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062520"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span> </span><span id="local-6989586621681062518"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681062518"><span class="hs-identifier hs-var">_cc</span></a></span></span><span> </span><span id="local-6989586621681062517"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062517"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681062516"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681062516"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Id -&gt; DataCon -&gt; [NonVoid StgArg] -&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.DataCon.html#cgTopRhsCon"><span class="hs-identifier hs-var">cgTopRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062522"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062520"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062517"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgArg] -&gt; [NonVoid StgArg]
</span><a href="GHC.StgToCmm.Closure.html#assertNonVoidStgArgs"><span class="hs-identifier hs-var">assertNonVoidStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681062516"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>      </span><span class="hs-comment">-- con args are always non-void,</span><span>
</span><span id="line-188"></span><span>      </span><span class="hs-comment">-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise</span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.StgToCmm.html#cgTopRhs"><span class="hs-identifier hs-var">cgTopRhs</span></a></span><span> </span><span id="local-6989586621681062513"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062513"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681062512"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681062512"><span class="hs-identifier hs-var">rec</span></a></span></span><span> </span><span id="local-6989586621681062511"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062511"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span id="local-6989586621681062509"><span class="annot"><span class="annottext">XRhsClosure 'CodeGen
</span><a href="#local-6989586621681062509"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681062508"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681062508"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span id="local-6989586621681062507"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681062507"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span> </span><span id="local-6989586621681062506"><span class="annot"><span class="annottext">[BinderP 'CodeGen]
</span><a href="#local-6989586621681062506"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681062505"><span class="annot"><span class="annottext">GenStgExpr 'CodeGen
</span><a href="#local-6989586621681062505"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-191"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">isEmptyDVarSet</span><span> </span><span class="hs-identifier">fvs</span><span class="hs-special">)</span><span>    </span><span class="hs-comment">-- There should be no free variables</span><span>
</span><span id="line-192"></span><span>    </span><span class="annot"><span class="annottext">DynFlags
-&gt; RecFlag
-&gt; Id
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [Id]
-&gt; GenStgExpr 'CodeGen
-&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.Bind.html#cgTopRhsClosure"><span class="hs-identifier hs-var">cgTopRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062513"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681062512"><span class="hs-identifier hs-var">rec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681062511"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681062508"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681062507"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681062506"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'CodeGen
</span><a href="#local-6989586621681062505"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-196"></span><span class="hs-comment">--      Module initialisation code</span><span>
</span><span id="line-197"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="annot"><a href="GHC.StgToCmm.html#mkModuleInit"><span class="hs-identifier hs-type">mkModuleInit</span></a></span><span>
</span><span id="line-200"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CollectedCCs"><span class="hs-identifier hs-type">CollectedCCs</span></a></span><span>         </span><span class="hs-comment">-- cost centre info</span><span>
</span><span id="line-201"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-202"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HpcInfo"><span class="hs-identifier hs-type">HpcInfo</span></a></span><span>
</span><span id="line-203"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span id="mkModuleInit"><span class="annot"><span class="annottext">mkModuleInit :: CollectedCCs -&gt; Module -&gt; HpcInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#mkModuleInit"><span class="hs-identifier hs-var hs-var">mkModuleInit</span></a></span></span><span> </span><span id="local-6989586621681062500"><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621681062500"><span class="hs-identifier hs-var">cost_centre_info</span></a></span></span><span> </span><span id="local-6989586621681062499"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681062499"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621681062498"><span class="annot"><span class="annottext">HpcInfo
</span><a href="#local-6989586621681062498"><span class="hs-identifier hs-var">hpc_info</span></a></span></span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Module -&gt; HpcInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Hpc.html#initHpc"><span class="hs-identifier hs-var">initHpc</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681062499"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">HpcInfo
</span><a href="#local-6989586621681062498"><span class="hs-identifier hs-var">hpc_info</span></a></span><span>
</span><span id="line-207"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CollectedCCs -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#initCostCentres"><span class="hs-identifier hs-var">initCostCentres</span></a></span><span> </span><span class="annot"><span class="annottext">CollectedCCs
</span><a href="#local-6989586621681062500"><span class="hs-identifier hs-var">cost_centre_info</span></a></span><span>
</span><span id="line-208"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-212"></span><span class="hs-comment">--      Generating static stuff for algebraic data types</span><span>
</span><span id="line-213"></span><span class="hs-comment">---------------------------------------------------------------</span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="annot"><a href="GHC.StgToCmm.html#cgEnumerationTyCon"><span class="hs-identifier hs-type">cgEnumerationTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span id="cgEnumerationTyCon"><span class="annot"><span class="annottext">cgEnumerationTyCon :: TyCon -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgEnumerationTyCon"><span class="hs-identifier hs-var hs-var">cgEnumerationTyCon</span></a></span></span><span> </span><span id="local-6989586621681062496"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062496"><span class="hs-identifier hs-var">tycon</span></a></span></span><span>
</span><span id="line-218"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681062495"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062495"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-219"></span><span>       </span><span class="annot"><span class="annottext">CLabel -&gt; [CmmLit] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#emitRODataLits"><span class="hs-identifier hs-var">emitRODataLits</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; CafInfo -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkLocalClosureTableLabel"><span class="hs-identifier hs-var">mkLocalClosureTableLabel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062496"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CafInfo
</span><a href="GHC.Types.Id.Info.html#NoCafRefs"><span class="hs-identifier hs-var">NoCafRefs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>             </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CLabel -&gt; Int -&gt; CmmLit
</span><a href="GHC.Cmm.Expr.html#CmmLabelOff"><span class="hs-identifier hs-var">CmmLabelOff</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; CafInfo -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkLocalClosureLabel"><span class="hs-identifier hs-var">mkLocalClosureLabel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; Name
</span><a href="GHC.Core.DataCon.html#dataConName"><span class="hs-identifier hs-var">dataConName</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062486"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CafInfo
</span><a href="GHC.Types.Id.Info.html#NoCafRefs"><span class="hs-identifier hs-var">NoCafRefs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; DataCon -&gt; Int
</span><a href="GHC.StgToCmm.Closure.html#tagForCon"><span class="hs-identifier hs-var">tagForCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062495"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062486"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681062486"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062486"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681062496"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="annot"><a href="GHC.StgToCmm.html#cgDataCon"><span class="hs-identifier hs-type">cgDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span class="hs-comment">-- Generate the entry code, info tables, and (for niladic constructor)</span><span>
</span><span id="line-227"></span><span class="hs-comment">-- the static closure, for a constructor.</span><span>
</span><span id="line-228"></span><span id="cgDataCon"><span class="annot"><span class="annottext">cgDataCon :: DataCon -&gt; FCode ()
</span><a href="GHC.StgToCmm.html#cgDataCon"><span class="hs-identifier hs-var hs-var">cgDataCon</span></a></span></span><span> </span><span id="local-6989586621681062484"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062484"><span class="hs-identifier hs-var">data_con</span></a></span></span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681062483"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062483"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-230"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681062482"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681062482"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-231"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-232"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681062480"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062480"><span class="hs-identifier hs-var">tot_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-comment">--  #ptr_wds + #nonptr_wds</span><span>
</span><span id="line-233"></span><span>             </span><span id="local-6989586621681062479"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062479"><span class="hs-identifier hs-var">ptr_wds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">--  #ptr_wds</span><span>
</span><span id="line-234"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [NonVoid PrimRep] -&gt; (Int, Int)
</span><a href="GHC.StgToCmm.Layout.html#mkVirtConstrSizes"><span class="hs-identifier hs-var">mkVirtConstrSizes</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062483"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid PrimRep]
</span><a href="#local-6989586621681062477"><span class="hs-identifier hs-var">arg_reps</span></a></span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>            </span><span id="local-6989586621681062474"><span class="annot"><span class="annottext">nonptr_wds :: Int
</span><a href="#local-6989586621681062474"><span class="hs-identifier hs-var hs-var">nonptr_wds</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062480"><span class="hs-identifier hs-var">tot_wds</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062479"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span>            </span><span id="local-6989586621681062473"><span class="annot"><span class="annottext">dyn_info_tbl :: CmmInfoTable
</span><a href="#local-6989586621681062473"><span class="hs-identifier hs-var hs-var">dyn_info_tbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-239"></span><span>              </span><span class="annot"><span class="annottext">DynFlags -&gt; DataCon -&gt; Bool -&gt; Int -&gt; Int -&gt; CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#mkDataConInfoTable"><span class="hs-identifier hs-var">mkDataConInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062483"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062484"><span class="hs-identifier hs-var">data_con</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062479"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681062474"><span class="hs-identifier hs-var">nonptr_wds</span></a></span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span>            </span><span class="hs-comment">-- We're generating info tables, so we don't know and care about</span><span>
</span><span id="line-242"></span><span>            </span><span class="hs-comment">-- what the actual arguments are. Using () here as the place holder.</span><span>
</span><span id="line-243"></span><span>            </span><span class="annot"><a href="#local-6989586621681062477"><span class="hs-identifier hs-type">arg_reps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier hs-type">PrimRep</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-244"></span><span>            </span><span id="local-6989586621681062477"><span class="annot"><span class="annottext">arg_reps :: [NonVoid PrimRep]
</span><a href="#local-6989586621681062477"><span class="hs-identifier hs-var hs-var">arg_reps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">PrimRep -&gt; NonVoid PrimRep
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621681062470"><span class="hs-identifier hs-var">rep_ty</span></a></span><span>
</span><span id="line-245"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681062469"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681062469"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConRepArgTys"><span class="hs-identifier hs-var">dataConRepArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062484"><span class="hs-identifier hs-var">data_con</span></a></span><span>
</span><span id="line-246"></span><span>                       </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681062470"><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621681062470"><span class="hs-identifier hs-var">rep_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; [PrimRep]
Type -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#typePrimRep"><span class="hs-identifier hs-var">typePrimRep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621681062469"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrimRep -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isVoidRep"><span class="hs-identifier hs-var">isVoidRep</span></a></span><span> </span><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621681062470"><span class="hs-identifier hs-var">rep_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmInfoTable -&gt; Convention -&gt; [LocalReg] -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureAndInfoTable"><span class="hs-identifier hs-var">emitClosureAndInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681062473"><span class="hs-identifier hs-var">dyn_info_tbl</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeDirectCall"><span class="hs-identifier hs-var">NativeDirectCall</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-250"></span><span>            </span><span class="hs-comment">-- NB: the closure pointer is assumed *untagged* on</span><span>
</span><span id="line-251"></span><span>            </span><span class="hs-comment">-- entry to a constructor.  If the pointer is tagged,</span><span>
</span><span id="line-252"></span><span>            </span><span class="hs-comment">-- then we should not be entering it.  This assumption</span><span>
</span><span id="line-253"></span><span>            </span><span class="hs-comment">-- is used in ldvEnter and when tagging the pointer to</span><span>
</span><span id="line-254"></span><span>            </span><span class="hs-comment">-- return it.</span><span>
</span><span id="line-255"></span><span>            </span><span class="hs-comment">-- NB 2: We don't set CC when entering data (WDP 94/06)</span><span>
</span><span id="line-256"></span><span>            </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyEnterDynCon"><span class="hs-identifier hs-var">tickyEnterDynCon</span></a></span><span>
</span><span id="line-257"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#ldvEnter"><span class="hs-identifier hs-var">ldvEnter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">CmmReg
</span><a href="GHC.Cmm.Expr.html#nodeReg"><span class="hs-identifier hs-var">nodeReg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyReturnOldCon"><span class="hs-identifier hs-var">tickyReturnOldCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NonVoid PrimRep] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid PrimRep]
</span><a href="#local-6989586621681062477"><span class="hs-identifier hs-var">arg_reps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ReturnKind -&gt; FCode ()
forall (f :: * -&gt; *) a. Functor f =&gt; f a -&gt; f ()
</span><a href="../../base/src/Data.Functor.html#void"><span class="hs-identifier hs-var">void</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode ReturnKind -&gt; FCode ()) -&gt; FCode ReturnKind -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitReturn"><span class="hs-identifier hs-var">emitReturn</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; Int -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmOffsetB"><span class="hs-identifier hs-var">cmmOffsetB</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681062482"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">CmmReg
</span><a href="GHC.Cmm.Expr.html#nodeReg"><span class="hs-identifier hs-var">nodeReg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; DataCon -&gt; Int
</span><a href="GHC.StgToCmm.Closure.html#tagForCon"><span class="hs-identifier hs-var">tagForCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681062483"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681062484"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-260"></span><span>               </span><span class="hs-special">}</span><span>
</span><span id="line-261"></span><span>                    </span><span class="hs-comment">-- The case continuation code expects a tagged pointer</span><span>
</span><span id="line-262"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-263"></span></pre></body></html>